package com.example.loginsystem.api;

import com.example.loginsystem.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Cheung0
 * Created on 2021/11/29
 */
@RestController
@RequestMapping("/api/role")
public class RoleAPI {

    @Autowired
    private RoleService roleService;

    @GetMapping("/getRoleName/{userName}")
    public String getRoleName(@PathVariable("userName") String userName) {
        return roleService.getByUserName(userName).getRoleName();
    }

}
